#region

using System;
using System.ComponentModel.DataAnnotations;
using InfoTech.VinhSon.Bussiness;

#endregion

namespace InfoTech.VinhSon.Models
{
    [Serializable]
    public partial class ConfigModel
    {
        #region Constructor

        public ConfigModel()
        {
        }

        public ConfigModel(Config value)
        {
            Id = value.Id;
            Name = value.Name;
            Value = value.Value;
            IsUploadFile = value.IsUploadFile ?? false;
        }

        #endregion

        #region Fields

        private Int32 _Id;

        private Boolean _IsUploadFile;

        private String _Name;

        private String _Value;

        #endregion

        #region Properties

        //[Required]
        //[Range(0, 0]
        //[StringLength(0)]
        public Int32 Id
        {
            get
            {
                return _Id;
            }
            set
            {
                _Id = value;
            }
        }

        //[Required]
        //[Range(0, 0]
        [StringLength(500)]
        public String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
            }
        }

        //[Required]
        //[Range(0, 0]
        [StringLength(1000)]
        public String Value
        {
            get
            {
                return _Value;
            }
            set
            {
                _Value = value;
            }
        }

        //[Required]
        //[Range(0, 0]
        //[StringLength(0)]
        public Boolean IsUploadFile
        {
            get
            {
                return _IsUploadFile;
            }
            set
            {
                _IsUploadFile = value;
            }
        }

        #endregion

        #region Operators

        public void Update(Config value)
        {
            // value.Id = Id;
            //value.Name = Name;
            //value.Value = Value;
            //value.IsUploadFile = IsUploadFile;
        }

        public static implicit operator ConfigModel(Config obj)
        {
            return new ConfigModel(obj);
        }

        public static implicit operator Config(ConfigModel obj)
        {
            Config value = new Config();
            obj.Update(value);
            return value;
        }

        #endregion
    }
}
